package com.alan.wifishare.view.ui;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.alan.wifishare.R;
import com.alan.wifishare.model.business.ScanedWifiInfo;

/**
 * @className: CNTDialogWifiScanAdapter
 * @describtion: CNTDialogWifiScanAdapter
 * @author: AlanWang
 * @email: 850267876@qq.com
 * @time: 2016/5/4 12:01
 */
public class CNTDialogWifiScanAdapter extends ALBaseAdapter<ScanedWifiInfo> {
    public CNTDialogWifiScanAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parentView) {
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.cnt_dialog_wifi_scan_listview_item, null);
            viewHolder = new ViewHolder();
            viewHolder.wifiStatusIv = (ImageView)convertView.findViewById(R.id.cntScanWifiDialogItemIconIv);
            viewHolder.wifiNameTv = (TextView)convertView.findViewById(R.id.cntScanWifiDialogItemNameTv);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder)convertView.getTag();
        }
        ScanedWifiInfo scanedWifiInfo = getItemList().get(position);
        viewHolder.wifiNameTv.setText(scanedWifiInfo.getSSID());
        return convertView;
    }

    private class ViewHolder {
        public ImageView wifiStatusIv;
        public TextView wifiNameTv;
    }
}
